-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build only lib from package #839
Conversation
I think the plan was to add |
@alexcrichton hmm, my motivation was:
So if sticking with the
It is not just about platform support - it also might speed up compilation when all you need is the library itself. |
Ok thinking about this, I think this may be the best way to go. The reason I didn't like Here though I don't think it's worth it to implement In the end I think that I'll consult with a few others about this tomorrow and get back to you about what we think the best way to go about this is. Also cc @stepancheg, this is basically the same outcome for #843 I believe. |
hmm, any ideas why it fails cross compile tests on OS X and if it is really related to this patch (it seems to be an error with lib paths as it can't find std crate)? |
Ah it's ok, it looks like the download of the nightly failed which was probably spurious |
@vhbit, @stepancheg, alright, let's move forward with these PRs. I'll rename |
|
||
assert_that(p.cargo_process("build").arg("--lib"), | ||
execs().with_status(0)); | ||
assert_that(&p.bin("foo"), is_not(existing_file())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you test against the output with -v
to ensure that the library actually was built?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, isn't it enough just to test if lib file exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that'd also work.
With rust-lang#843 and rust-lang#839 coming around the bend soon, the original decision for `--name` everywhere isn't making as much sense, for consistence this is renaming these flags back to `--<target-name>` for the respective targets.
Added error if no libs are presented, added a test case for it, also while building just lib checking verbose output. |
@@ -27,6 +27,7 @@ macro_rules! test( | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this file turned into an executable, could you flip it back?
Looks great, thanks @vhbit! |
Ahh, that strange problem with Anyway, fixed. |
}).filter(|target| !lib_only || target.is_lib()).collect::<Vec<&Target>>(); | ||
|
||
if lib_only && targets.len() == 0 { | ||
return Err(human("There is no lib to build, remove `--lib` flag".to_string())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this (back ref: https://github.com/rust-lang/cargo/pull/14163/files#r1658125218)
Fixes #724